package org.aclyyx.malata.app.e5;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.util.ArrayList;
import java.util.List;

import org.aclyyx.malata.app.StaticData;

public class ReadAll {

	public List<AllObj> read() throws Exception {

		File file = new File(StaticData.E5_ALL_DATA_PATH);
		List<AllObj> all = null;
		if (file.exists()) {
			ObjectInputStream ois = new ObjectInputStream(new FileInputStream(file));
			Object obj = ois.readObject();
			if (obj instanceof List<?>) {
				all = (List<AllObj>) obj;
			}
			if (all == null) {
				all = new ArrayList<AllObj>();
			}
			ois.close();
		} else {
			if (all == null) {
				all = new ArrayList<AllObj>();
			}
		}
		return all;
	}
}
